package com.work.vo.transport;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.work.constant.DictBizConstant;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.cache.DictBizCache;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * 船统计船列表
 *
 * @author ：dujianyu
 * @since ：Created in 2024/6/25 14:32
 */
@Data
public class TShipForecastShipStatVO {

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "船ID")
    private Long transportShipId;

    @ApiModelProperty(value = "出口船信息")
    private String expShipInfo;

    public String getExpShipInfo() {
        List<String> infoList = new ArrayList<>();
        infoList.add(getShipNameZh());
        infoList.add(getExpVoyage());
        return StringUtil.join(infoList, "/");
    }


    @ApiModelProperty(value = "进口船信息")
    private String impShipInfo;

    public String getImpShipInfo() {
        List<String> infoList = new ArrayList<>();
        infoList.add(getShipNameZh());
        infoList.add(getImpVoyage());
        return StringUtil.join(infoList, "/");
    }


    @ApiModelProperty(value = "船名")
    private String shipNameZh;

    @ApiModelProperty(value = "预报状态")
    private String forecastStatus;

    @ApiModelProperty(value = "预报状态")
    private String forecastStatusName;

    public String getForecastStatusName() {
        if (Func.isNull(forecastStatus)) {
            return null;
        }
        return DictBizCache.getValue(DictBizConstant.FORECAST_STATUS, forecastStatus);
    }

    @ApiModelProperty(value = "计划泊位")
    private String planBerthName;

    @ApiModelProperty(value = "实际泊位")
    private String lastBerthName;

    private String berthName;

    public String getBerthName() {
        return Func.isNull(lastBerthName)?planBerthName:lastBerthName;
    }

    @ApiModelProperty(value = "进口航次")
    private String impVoyage;

    @ApiModelProperty(value = "出口航次")
    private String expVoyage;

    @ApiModelProperty(value = "靠泊时间")
    private LocalDateTime rtb;

    @ApiModelProperty(value = "离港时间")
    private LocalDateTime rtd;

}
